package com.mit.common.purchase.dto;

import java.math.BigDecimal;
import java.util.Date;

import com.mit.common.design.dto.FabricDTO;
import com.mit.common.dto.AbstractDTO;
import com.mit.common.inventory.dto.WarehouseDTO;
import com.mit.common.maintenance.dto.ProductColorDTO;
import com.mit.common.manufacture.dto.MODTO;
import com.mit.common.manufacture.dto.MOItemDTO;

public class POItemDTO extends AbstractDTO {
	
	private Integer poId;
	private MOItemDTO moItem; //生产单数量
	private MODTO mo;	//生产单
	private FabricDTO fabric; //原料
	private Integer supplierId;
	private String supplierName;
	private MaterialDTO material; //供应商原料
	private ColorStyleDTO materialColor; //供应商颜色
	private BigDecimal price;
	private String unit;
	private BigDecimal purchasedQty;
	private BigDecimal receivedQty;
	private BigDecimal qty;
	private WarehouseDTO warehouse;
	private Date latestDeiverDate;
	
	public POItemDTO(){
		moItem = new MOItemDTO();
		mo = new MODTO();
		fabric = new FabricDTO();
		material = new MaterialDTO();
		materialColor = new ColorStyleDTO();
		warehouse = new WarehouseDTO();
	}
	
	

	@Override
	public boolean equals(Object obj) {
		if(obj == null)
			return false;
		if(! (obj instanceof POItemDTO))
			return false;
		
		POItemDTO another = (POItemDTO) obj;
		return (supplierId.equals(another.getSupplierId())
		&& material.getId().equals(another.getMaterial().getId())
		&& materialColor.getId().equals(another.getMaterialColor().getId())
		&& (price.compareTo(another.getPrice()) == 0)
		&& (warehouse.getId().equals(another.getWarehouse().getId()))
		&& ( latestDeiverDate.compareTo(another.getLatestDeiverDate()) == 0));
	}



	public BigDecimal getReceivedQty() {
		return receivedQty;
	}



	public void setReceivedQty(BigDecimal receivedQty) {
		this.receivedQty = receivedQty;
	}



	public String getSupplierName() {
		return supplierName;
	}



	public void setSupplierName(String supplierName) {
		this.supplierName = supplierName;
	}



	public Integer getSupplierId() {
		return supplierId;
	}



	public void setSupplierId(Integer supplierId) {
		this.supplierId = supplierId;
	}



	public BigDecimal getPurchasedQty() {
		return purchasedQty;
	}



	public void setPurchasedQty(BigDecimal purchasedQty) {
		this.purchasedQty = purchasedQty;
	}



	public MOItemDTO getMoItem() {
		return moItem;
	}



	public void setMoItem(MOItemDTO moItem) {
		this.moItem = moItem;
	}



	public MODTO getMo() {
		return mo;
	}



	public void setMo(MODTO mo) {
		this.mo = mo;
	}



	public BigDecimal getQty() {
		return qty;
	}

	public void setQty(BigDecimal qty) {
		this.qty = qty;
	}

	public Integer getPoId() {
		return poId;
	}

	public FabricDTO getFabric() {
		return fabric;
	}

	public void setFabric(FabricDTO fabric) {
		this.fabric = fabric;
	}

	public void setPoId(Integer poId) {
		this.poId = poId;
	}


	public MaterialDTO getMaterial() {
		return material;
	}
	public void setMaterial(MaterialDTO material) {
		this.material = material;
	}
	public ColorStyleDTO getMaterialColor() {
		return materialColor;
	}
	public void setMaterialColor(ColorStyleDTO materialColor) {
		this.materialColor = materialColor;
	}
	public BigDecimal getPrice() {
		return price;
	}
	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	public String getUnit() {
		return unit;
	}
	public void setUnit(String unit) {
		this.unit = unit;
	}
	public WarehouseDTO getWarehouse() {
		return warehouse;
	}
	public void setWarehouse(WarehouseDTO warehouse) {
		this.warehouse = warehouse;
	}
	public Date getLatestDeiverDate() {
		return latestDeiverDate;
	}
	public void setLatestDeiverDate(Date latestDeiverDate) {
		this.latestDeiverDate = latestDeiverDate;
	}
	
}
